home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / snippets_vol1 / snip_2d_snow.dba < prev    next >
Encoding:
Text File  |  2000-08-05  |  834 b   |  48 lines

  1. `    ------------------------------------------------------------------------
  2. `    2D Snow Effect                              DarkForge Snippet (6/8/2000)
  3. `    ------------------------------------------------------------------------
  4. `
  5. `    A nice resolution independant 2D snow effect.
  6. `    Change the snow value for more/less flakes.
  7.  
  8. sync rate 0
  9. sync on
  10. hide mouse
  11.  
  12. snow=250
  13.  
  14. dim sx(snow)
  15. dim sy(snow)
  16.  
  17. for t=0 to snow
  18.     sx(t)=rnd(screen width())
  19.     sy(t)=rnd(screen height()-1)
  20. next t
  21.  
  22. do
  23.  
  24.     for t=0 to snow
  25.  
  26.         if sy(t)=screen height()-1 then sy(t)=0
  27.  
  28.         v=rnd(15)+1
  29.  
  30.         ink rgb(0,0,0),1
  31.         dot sx(t),sy(t)
  32.  
  33.         if v<6 then sx(t)=sx(t)+1
  34.         if v>10 then sx(t)=sx(t)-1
  35.  
  36.         sy(t)=sy(t)+1
  37.  
  38.         if sy(t)>screen height()-1 then sy(t)=screen height()
  39.  
  40.         ink rgb(255,255,255),1
  41.         dot sx(t),sy(t)
  42.  
  43.     next t
  44.  
  45.     sync
  46.  
  47. loop
  48.